<!DOCTYPE html>
<html lang="en">
<head>
	<title>收货地址-{$tpshop_config['shop_info_store_title']}</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no, width=device-width">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" type="text/css" href="__STATIC__/yt_css/swiper.css">
	<link rel="stylesheet" type="text/css" href="__STATIC__/yt_css/style.css">
	<link rel="stylesheet" type="text/css" href="__STATIC__/yt_css/ipad.css">
	<link rel="stylesheet" type="text/css" href="__STATIC__/yt_css/iphone.css">
    <script type="text/javascript" src="__STATIC__/yt_js/jquery-1.9.0.min.js"></script>
    <script src="__PUBLIC__/js/layer/layer.js"></script>
</head>
<body class="body">
<div class="container">
	<include file="user/new_header" w="w1224"/>
	<div class="fexiao_content">
		<div class="left">
			<h2>分销中心</h2>
			<include file="user/new_menu" w="w1224"/>
		</div>
		<div class="right yhk_right">
			<h2><span>地址管理</span></h2>
			<volist name="lists" id="list">
				<div class="rt2 rt3 rt5">
					<div>
						<span>收货人</span>
                        <span>地区</span>
						<span>详细地址</span>
						<span>电话</span>
						<span>操作</span>
					</div>
					<div>
						<span>{$list.consignee}</span>
                        <span>{$region_list[$list['province']]}{$region_list[$list['city']]}{$region_list[$list['district']]}{$region_list[$list['twon']]}</span>
						<span>{$list.address}</span>
						<span>{$list.mobile}</span>
						<span>
                              <a href="{:U('Home/User/del_address',array('id'=>$list['address_id']))}" class="del">删除</a> &nbsp;|&nbsp;
                              <a href="javascript:address_edit({$list['address_id']})">编辑</a> &nbsp;|&nbsp;
                            <if condition="$list['is_default'] neq 1">
                                <a href="{:U('Home/User/set_default',array('id'=>$list['address_id']))}" >设为默认</a>
                                <else/>
                                <a style="color: #FF4466">默认地址</a>
                            </if>

                        </span>
					</div>
				</div>
			</volist>
			<button onclick="address_edit()">新增收货地址>></button>
		</div>
		<div class="clear"></div>
	</div>
	<div class="footer">
        <include file="public/new_footer" w="w1224"/>
	</div>
</div>

<script type="text/javascript">
	/*点击左边标签部分选中状态*/
	$(".left ul li a").click(function(){
		$(".left ul li a").removeClass("active");
		$(this).addClass("active");
	})
	/*点击删除所在行*/
	$(".del").click(function(){
		$(this).parent().parent().parent().remove()
	})

    /**
     * 新增修改收货地址
     * id 为零 则为新增, 否则是修改
     *  使用 公共的 layer 弹窗插件  参考官方手册 http://layer.layui.com/
     */
    function address_edit(id)
    {
        if(id > 0)
            var url = "/index.php?m=Home&c=User&a=edit_address&scene=1&call_back=call_back_fun&id="+id; // 修改地址  '/index.php/Home/User/add_address/scene/1/call_back/call_back_fun/id/id' //iframe的url /index.php/Home/User/add_address
        else
            var url = "/index.php?m=Home&c=User&a=add_address&scene=1&call_back=call_back_fun";	// 新增地址
        layer.open({
            type: 2,
            title: '添加收货地址',
            shadeClose: true,
            shade: 0.8,
            area: ['880px', '580px'],
            content: url,
        });
    }
    // 添加修改收货地址回调函数
    function call_back_fun(v){
        layer.closeAll(); // 关闭窗口
        location.href = location.href;
    }

</script>
</body>

</html>